<?php

// 加载基础文件
require __DIR__ . '/../thinkphp/base.php';
use think\facade\Request;

$host = [
    'http://localhost:8080'
];

$origin = Request::header('origin');

if (in_array($origin, $host)) {
    header('Access-Control-Allow-Origin:' . $origin);
}
header('Access-Control-Allow-Credentials:true');
header('Access-Control-Allow-Methods:GET, POST, PATCH, PUT, DELETE');
header('Access-Control-Allow-Headers:Authorization, Content-Type, If-Match, X-Driver, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With');
if (Request::isOptions()) {
    exit;
}

// 执行应用并响应
\think\Container::get('app')
    ->run()
    ->send();
